package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.WmsInventoryAlertMapper;
import com.ruoyi.system.domain.WmsInventoryAlert;
import com.ruoyi.system.service.IWmsInventoryAlertService;
import com.ruoyi.common.core.text.Convert;

/**
 * 库存预警设置Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-18
 */
@Service
public class WmsInventoryAlertServiceImpl implements IWmsInventoryAlertService 
{
    @Autowired
    private WmsInventoryAlertMapper wmsInventoryAlertMapper;

    /**
     * 查询库存预警设置
     * 
     * @param alertId 库存预警设置主键
     * @return 库存预警设置
     */
    @Override
    public WmsInventoryAlert selectWmsInventoryAlertByAlertId(Long alertId)
    {
        return wmsInventoryAlertMapper.selectWmsInventoryAlertByAlertId(alertId);
    }

    /**
     * 查询库存预警设置列表
     * 
     * @param wmsInventoryAlert 库存预警设置
     * @return 库存预警设置
     */
    @Override
    public List<WmsInventoryAlert> selectWmsInventoryAlertList(WmsInventoryAlert wmsInventoryAlert)
    {
        return wmsInventoryAlertMapper.selectWmsInventoryAlertList(wmsInventoryAlert);
    }

    /**
     * 新增库存预警设置
     * 
     * @param wmsInventoryAlert 库存预警设置
     * @return 结果
     */
    @Override
    public int insertWmsInventoryAlert(WmsInventoryAlert wmsInventoryAlert)
    {
        wmsInventoryAlert.setCreateTime(DateUtils.getNowDate());
        return wmsInventoryAlertMapper.insertWmsInventoryAlert(wmsInventoryAlert);
    }

    /**
     * 修改库存预警设置
     * 
     * @param wmsInventoryAlert 库存预警设置
     * @return 结果
     */
    @Override
    public int updateWmsInventoryAlert(WmsInventoryAlert wmsInventoryAlert)
    {
        wmsInventoryAlert.setUpdateTime(DateUtils.getNowDate());
        return wmsInventoryAlertMapper.updateWmsInventoryAlert(wmsInventoryAlert);
    }

    /**
     * 批量删除库存预警设置
     * 
     * @param alertIds 需要删除的库存预警设置主键
     * @return 结果
     */
    @Override
    public int deleteWmsInventoryAlertByAlertIds(String alertIds)
    {
        return wmsInventoryAlertMapper.deleteWmsInventoryAlertByAlertIds(Convert.toStrArray(alertIds));
    }

    /**
     * 删除库存预警设置信息
     * 
     * @param alertId 库存预警设置主键
     * @return 结果
     */
    @Override
    public int deleteWmsInventoryAlertByAlertId(Long alertId)
    {
        return wmsInventoryAlertMapper.deleteWmsInventoryAlertByAlertId(alertId);
    }
}
